package com.zs.lib_base.http

import android.content.Context
import com.zs.lib_base.bean.*
import com.zs.lib_base.common.Constants
import com.zs.lib_base.model.*
import io.reactivex.rxjava3.core.Observable
import okhttp3.MultipartBody
import okhttp3.RequestBody

class DataManager(context: Context) {

    var mRetrofitService: RetrofitService = RetrofitHelper.getInstance(context).getGsonServer(Constants.BASE_URL)
    var mRetrofitScalarService: RetrofitService = RetrofitHelper.getInstance(context).getScalarsServer(Constants.BASE_URL)


    var mContext: Context = context

    fun getInterestList(): Observable<InterestListBean> {
        return mRetrofitService.getInterestList()
    }

//    fun choseInterest(requestBody: RequestBody): Observable<String> {
//        return mRetrofitScalarService.chooseInterest(requestBody)
//    }
    fun choseInterest(ids: String,token: String): Observable<ChoseInterestBean> {
        return mRetrofitService.chooseInterest(ids,token)
    }

    fun getSearchHistoryList(token: String): Observable<SearchHistoryListBean> {
        return mRetrofitService.queryContentSearchHistoryList(token)
    }

    fun integratedContentSearch(token: String,keyword: String): Observable<BaseData<SearchBean>> {
        return mRetrofitService.integratedContentSearch(token,keyword)
    }

//    fun reportNewsTrend(id: Int?=0,submitType: Int?=0,type: Int?=0,content: String="",report: String="",token: String): Observable<BaseData<SearchBean>> {
//        return mRetrofitService.reportNewsTrend(id!!,submitType!!,type!!,content,report,token)
//    }

    fun reportNewsTrend(requestBody: RequestBody): Observable<BaseData<SearchBean>> {
        return mRetrofitService.reportNewsTrend(requestBody)
    }

    fun queryHotspotList(): Observable<BaseData<MutableList<HotListBean>>> {
        return mRetrofitService.queryHotspotList()
    }

    fun follow(token: String,userId: Int): Observable<BaseData<NullBean>> {
        return mRetrofitService.follow(token,userId)
    }

    fun cancelfollow(token: String,userId: Int): Observable<BaseData<NullBean>> {
        return mRetrofitService.cancelfollow(token,userId)
    }


    fun getSystemMessage(token: String): Observable<BaseData<MutableList<SystemBean>>> {
        return mRetrofitService.getSystemMessage(token)
    }
    fun getCommentMessage(token: String,start: Int,limit: String): Observable<BaseData<CommentBean>> {
        return mRetrofitService.getCommentMessage(token,start,limit)
    }
    fun getZanMessage(token: String,start: Int,limit: String): Observable<BaseData<UpBean>> {
        return mRetrofitService.getZanMessage(token,start,limit)
    }
//    fun publishTrend(requestBody: RequestBody): Observable<BaseData<MutableList<FansBean>>> {
//        return mRetrofitService.publishTrend(requestBody)
//    }

    fun getFans(token: String): Observable<BaseData<MutableList<MyFansListModel>>> {
        return mRetrofitService.getFans(token)
    }

    fun publishTrend( requestBody: RequestBody): Observable<BaseData<PublishBean>> {
        return mRetrofitService.publishTrend(requestBody)
    }
    fun publishArtical( requestBody: RequestBody): Observable<BaseData<PublishBean>> {
        return mRetrofitService.publishArtical(requestBody)
    }
    fun uploadImage(token: String,file: MultipartBody.Part): Observable<BaseData<String>> {
        return mRetrofitService.uploadImage(token,file)
    }

    fun draftBox(token: String,start: Int,limit: Int): Observable<BaseData<DraftBoxBean>> {
        return mRetrofitService.draftBox(token,start,limit)
    }

    fun deleteNews(token: String,type: Int,id: Int): Observable<BaseData<NullBean>> {
        return mRetrofitService.deleteNews(token,type,id)
    }
    fun baseInfo(token: String, otherUserNo: String,userName: String, type: String): Observable<BaseData<UserBaseInfo>> {
        return mRetrofitService.baseInfo(token,otherUserNo,userName,type)
    }

    fun mainList(token: String, userId: String, userName: String, type: String, start: Int, limit: String): Observable<BaseData<PersonPageBean>> {
        return mRetrofitService.mainList(token,userId,userName,type,start,limit)
    }
    fun deleteNews(token: String, type: String, id: String): Observable<BaseData<PersonPageBean>> {
        return mRetrofitService.deleteNews(token,type,id)
    }

    fun pageAdvert(token: String): Observable<BaseData<MutableList<AdBean>>> {
        return mRetrofitService.pageAdvert(token)
    }

    fun getNewsTrendById(token: String, id: String): Observable<BaseData<DynamicDetailBean>> {
        return mRetrofitService.getNewsTrendById(token,id)
    }
    fun getDeleteNewsTrendById(token: String, id: String): Observable<BaseData<DynamicDeleteDetailBean>> {
        return mRetrofitService.getDeleteNewsTrendById(token,id)
    }
    fun deleteDraftBox(token: String, type: String,id: String): Observable<BaseData<String>> {
        return mRetrofitService.deleteDraftBox(token,type,id)
    }

    fun getComment(token: String, type: Int,id: Int): Observable<BaseData<MutableList<DetailCommentBean>>> {
        return mRetrofitService.getComment(token,type,id)
    }

    fun like(token: String, id: Int,type: Int): Observable<BaseData<String>> {
        return mRetrofitService.like(token,id,type)
    }

    fun comment(token: String, id: Int,type: Int,content: String): Observable<BaseData<String>> {
        return mRetrofitService.comment(token,id,type,content)
    }

    fun addCollection(token: String, id: Int,type: Int): Observable<BaseData<String>> {
        return mRetrofitService.addCollection(token,id,type)
    }
    fun deleteCollections(token: String, id: Int,type: Int): Observable<BaseData<String>> {
        return mRetrofitService.deleteCollections(token,id,type)
    }

    fun forwardNewsTrend(requestBody: RequestBody): Observable<BaseData<NullBean>> {
        return mRetrofitService.forwardNewsTrend(requestBody)
    }
    fun getVarietyIndex(): Observable<BaseData<MutableList<SouthwestBean>>> {
        return mRetrofitService.getVarietyIndex()
    }

    fun getVarietyIndexDetail(varietyId: String,areaId: String): Observable<BaseData<SouthestDetailBean>> {
        return mRetrofitService.getVarietyIndexDetail(varietyId,areaId)
    }

    fun myBrowsings(token: String, type: String,  start: Int, limit: String): Observable<BaseData<PersonPageBean>> {
        return mRetrofitService.myBrowsings(token,type,start,limit)
    }
    fun collections(token: String, type: String,  start: Int, limit: String): Observable<BaseData<PersonPageBean>> {
        return mRetrofitService.collections(token,type,start,limit)
    }
    fun deleteComment(token: String, id: String): Observable<BaseData<String>> {
        return mRetrofitService.deleteComment(token,id)
    }

    fun searchContact(token: String, keyword: String): Observable<BaseData<MutableList<SearchContactBean>>> {
        return mRetrofitService.searchContact(token,keyword)
    }

    fun searchHistory(token: String): Observable<BaseData<MutableList<SearchContactHistoryBean>>> {
        return mRetrofitService.searchHistory(token)
    }

    fun myInterest(token: String): Observable<BaseData<MutableList<InterestListBean.Data>>> {
        return mRetrofitService.myInterest(token)
    }

    fun hotList(token: String,hotId: String): Observable<BaseData<HotDetailBean>> {
        return mRetrofitService.hotList(token,hotId)
    }

    fun isShield(token: String,toUserId: String): Observable<BaseData<String>> {
        return mRetrofitService.isShield(token,toUserId)
    }

    fun removeShieldNew(token: String,userName: String,userId: String): Observable<BaseData<String>> {
        return mRetrofitService.removeShieldNew(token,userName,userId)
    }

    fun setShieldNew(token: String,userName: String,userId: String): Observable<BaseData<String>> {
        return mRetrofitService.setShieldNew(token,userName,userId)
    }

    fun setShieldPhone(token: String,userName: String): Observable<BaseData<String>> {
        return mRetrofitService.setShieldPhone(token,userName)
    }

    fun removeShieldPhone(token: String,userName: String): Observable<BaseData<String>> {
        return mRetrofitService.removeShieldPhone(token,userName)
    }

    fun isShieldPhone(token: String,toUserId: String): Observable<BaseData<String>> {
        return mRetrofitService.isShieldPhone(token,toUserId)
    }

    fun getMessageCount(token: String): Observable<BaseData<ConversationModel>> {
        return mRetrofitService.getMessageCount(token)
    }

    fun saveUser(token: String,avatar: String,gender: String,personName: String): Observable<BaseData<NullBean>> {
        return mRetrofitService.saveUser(token,avatar,gender,personName)
    }

    fun attentions(token: String): Observable<BaseData<MutableList<FollowModel>>> {
        return mRetrofitService.attentions(token)
    }

    fun recommendAttentions(): Observable<BaseData<MutableList<RecommentFollowModel>>> {
        return mRetrofitService.recommendAttentions()
    }

    fun oneKeyFollow(token: String,userIds: String): Observable<BaseData<String>> {
        return mRetrofitService.oneKeyFollow(token,userIds)
    }

    fun selectHotList(): Observable<BaseData<MutableList<MainHotBean>>> {
        return mRetrofitService.selectHotList()
    }

    fun getVideoById(token: String,movieId: String): Observable<BaseData<VideoDetailBean>> {
        return mRetrofitService.getVideoById(token,movieId)
    }

    fun getNewsById(token: String,id: String): Observable<BaseData<ArticleDetailBean>> {
        return mRetrofitService.getNewsById(token,id)
    }

    fun getAudioById(token: String,id: String): Observable<BaseData<DynamicDetailBean>> {
        return mRetrofitService.getAudioById(token,id)
    }
    fun addForwardCount(token: String,id: String, type: String): Observable<BaseData<String>> {
        return mRetrofitService.addForwardCount(token,id,type)
    }

    fun isShieldPhoneByOther(token: String,userName: String): Observable<BaseData<String>> {
        return mRetrofitService.isShieldPhoneByOther(token,userName)
    }

    fun recommendFollowUser(token: String): Observable<BaseData<MutableList<RecommentFollowUserBean>>> {
        return mRetrofitService.recommendFollowUser(token)
    }

    fun getEditNews(token: String,id: String): Observable<BaseData<EditArticleBean>> {
        return mRetrofitService.getEditNews(token,id)
    }

    fun getEditTrend(token: String,id: String): Observable<BaseData<EditDynamicBean>> {
        return mRetrofitService.getEditTrend(token,id)
    }

    fun getFriendUrl(token: String): Observable<BaseData<String>> {
        return mRetrofitService.getFriendUrl(token)
    }

    fun getZMerchatInfo(token: String,id: String): Observable<BaseData<MerchatInfoBean>> {
        return mRetrofitService.getZMerchatInfo(token,id)
    }

    fun shareApp(requestBody: RequestBody): Observable<BaseData<SharePopularityBean>> {
        return mRetrofitService.shareApp(requestBody)
    }

    fun shareApp2(id: String, regid: String,token: String): Observable<BaseData<SharePopularityBean>> {
        return mRetrofitService.shareApp2(id,regid,token)
    }

    fun listPlaceSteel(token: String): Observable<BaseData<MutableList<SteelBean>>> {
        return mRetrofitService.listPlaceSteel(token)
    }

    fun getAllAreaCombination(token: String): Observable<BaseData<MutableList<MerchantProvinceAddressBean>>> {
        return mRetrofitService.getAllAreaCombination(token)
    }
    fun listFourBase(token: String): Observable<BaseData<MutableList<MerchatFourBean>>> {
        return mRetrofitService.listFourBase(token)
    }
    fun uploadVide(token: String,dir: String,file: MultipartBody.Part): Observable<BaseData<UploadVideoBean>> {
        return mRetrofitService.uploadVide(token,dir,file)
    }
    fun addMerchatInfo(requestBody: RequestBody): Observable<BaseData<String>> {
        return mRetrofitService.addMerchatInfo(requestBody)
    }

    fun addSteel(token: String,name: String): Observable<BaseData<SteelBean>> {
        return mRetrofitService.addSteel(token,name)
    }

    fun rewardStatus(token: String): Observable<BaseData<String>> {
        return mRetrofitService.rewardStatus(token)
    }

    fun readReward(token: String,id: String,type: String,operType: String): Observable<BaseData<RewardBean>> {
        return mRetrofitService.readReward(token,id,type,operType)
    }

    fun isStartActivity(): Observable<BaseData<String>> {
        return mRetrofitService.isStartActivity()
    }

    fun startActivity(token: String,id: String,type: String): Observable<BaseData<StartClockBean>> {
        return mRetrofitService.startActivity(token,id,type)
    }

    fun getActivityStatus(): Observable<BaseData<ActivityStatusBean>> {
        return mRetrofitService.getActivityStatus()
    }

    fun getMyPunchInInfo(token: String): Observable<BaseData<ActivityInfoBean>> {
        return mRetrofitService.getMyPunchInInfo(token)
    }

    fun getVarietyIndex(token: String): Observable<BaseData<MutableList<VarietyIndexListBean>>> {
        return mRetrofitService.getVarietyIndex(token)
    }

    fun getAreaIndexList(): Observable<BaseData<MutableList<AreaIndexListBean>>> {
        return mRetrofitService.getAreaIndexList()
    }

    fun getMembership(token: String,entrance: String): Observable<BaseData<String>> {
        return mRetrofitService.getMembership(token,entrance)
    }

    fun addPush(token: String,type: Int): Observable<BaseData<String>> {
        return mRetrofitService.addPush(token,type)
    }

    fun deletePush(token: String,type: Int): Observable<BaseData<String>> {
        return mRetrofitService.deletePush(token,type)
    }

    fun getUserPushStatus(token: String): Observable<BaseData<MutableList<PushStatusBean>>> {
        return mRetrofitService.getUserPushStatus(token)
    }

}